# import numpy as np
# import pandas as pd
# detail=pd.read_excel('../data/meal_order_detail.xlsx',sheet_name='meal_order_detail1')
# print(detail)
# print(detail.size)
# print(detail.values)
# print(detail.index)
# print(detail.columns)
# # print(detail.dtypes)
# # print(detail.ndim)
# # print(detail.shape)
# print('dishes-name的具体数据：',detail['dishes_name'])
# detail1=detail['dishes_name'][1:50:2]
# print(detail1)
# detail1=detail[['detail_id','order_id','dishes_name','counts','amounts']][1:50:2]
# print(detail1)
# detail1=detail[['detail_id','order_id','dishes_name','counts','amounts']].head()
# print(detail1)
# detail1=detail[['detail_id','order_id','dishes_name','counts','amounts']].tail()
# print(detail1)
# detail1=detail[['detail_id','order_id','dishes_name','counts','amounts']].head(20)
# print(detail1)
# print("amounts 的最大值为：",np.max(detail['amounts']))
# print("amounts 的最小值为：",np.min(detail['amounts']))
# print("amounts 的中位数为为：",np.median(detail['amounts']))
# print("amounts 的平均值为：",np.mean(detail['amounts']))
#
# print("amounts 的最大值为：",detail['amounts'].max())
# print("amounts 的最小值为：",detail['amounts'].min())
# print("amounts 的中位数为为：",detail['amounts'].median())
# print("amounts 的平均值为：",detail['amounts'].mean())
# 代码 4-41
import pandas as pd
order = pd.read_table('../data/meal_order_info.csv',
      sep = ',',encoding = 'gbk')
print('进行转换前订单信息表lock_time的类型为：',
      order['lock_time'].dtypes)
order['lock_time'] = pd.to_datetime(order['lock_time'])
print('进行转换后订单信息表lock_time的类型为：',
      order['lock_time'].dtypes)



# 代码 4-42
print('最小时间为：', pd.Timestamp.min)
print('最大时间为：', pd.Timestamp.max)


# 代码 4-43
dateIndex = pd.DatetimeIndex(order['lock_time'])
print('转换为DatetimeIndex后数据的类型为：\n',type(dateIndex))

periodIndex = pd.PeriodIndex(order['lock_time'],freq = 'S')
print('转换为DatetimeIndex后数据的类型为：\n',type(periodIndex))
